cmake_minimum_required(VERSION 3.6)
project(compiler)

set(EXECUTABLE_OUTPUT_PATH bin)

find_package(BISON)
find_package(FLEX)
BISON_TARGET(Parser lex_bison/syntax.y ${CMAKE_CURRENT_SOURCE_DIR}/syntax.tab.cpp)
FLEX_TARGET(Lexer lex_bison/lexical.l ${CMAKE_CURRENT_SOURCE_DIR}/lex.yy.cpp)
ADD_FLEX_BISON_DEPENDENCY(Lexer Parser)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
MESSAGE(STATUS ${PROJECT_BINARY_DIR})
set(SOURCE_FILES
        gtree.cpp
        gtree.h
        lex.yy.cpp
        symtab.cpp
        symtab.h
        ${BISON_Parser_OUTPUT_SOURCE}
        ${BISON_Parser_OUTPUT_HEADER}
        check.cpp check.h iremit.cpp main.cpp asmemit.cpp)
link_libraries(fl y)
add_executable(compiler ${SOURCE_FILES})